cmake_minimum_required(VERSION 2.8)

project(collection)

set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-std=c++11")

include_directories(src)
include_directories(thirdparty)
#include_directories(/usr/include/)

link_directories("/usr/lib64/mysql/" "${CMAKE_CURRENT_SOURCE_DIR}/lib")

set(src_list 
    src/utils/Mutex.cpp
    src/utils/Thread.cpp
    src/utils/ThreadPool.cpp
    src/utils/TimeUtil.cpp
    src/utils/FileUtil.cpp
    src/utils/StringUtil.cpp
    src/log/Logger.cpp
    src/log/LogLevel.cpp
    src/log/LogEventImp.cpp
    src/log/LogEvent.cpp
    src/log/LogLayout.cpp
    src/log/LogAppender.cpp
    src/log/LoggerManager.cpp
    src/db/MySqlConf.cpp
    src/db/MySqlConn.cpp
    src/db/MySqlConnPool.cpp
    src/net/IPAddress.cpp
    src/net/Socket.cpp
    src/net/EventLoop.cpp
    src/net/Endian.cpp
    src/net/Connection.cpp
    src/net/TcpServer.cpp
    src/net/Acceptor.cpp
    src/net/Channel.cpp
    src/net/Epoll.cpp
)

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

set(libs 
        pthread
        mysqlclient
        json11
    )

#find_library(libs names pthread mysqlclient json11 hints /usr/lib/mysql/ ./lib/)

add_executable(test_log tests/test_log.cpp ${src_list})
add_executable(test_mysql tests/test_mysql.cpp ${src_list})
add_executable(test_server tests/test_server.cpp ${src_list})
add_executable(test_thread tests/test_thread.cpp ${src_list})

target_link_libraries(test_log ${libs})
target_link_libraries(test_mysql ${libs})
target_link_libraries(test_server ${libs})
target_link_libraries(test_thread ${libs})
